package com.accp.crm.service;

import java.util.List;

import org.hibernate.SessionFactory;

import com.accp.crm.dao.CommonDAO;
import com.accp.crm.entity.CstLost;
import com.accp.crm.entity.PageBean;

public class CstLostService implements ICstLostService {
	
    private CommonDAO<CstLost> lostdao;
	
    public void setSessionFactory(SessionFactory sessionFactory){
		lostdao=new CommonDAO<CstLost>(sessionFactory,CstLost.class);
	}

	@Override
	public List findAll() {
		List list = this.lostdao.findAll();
		return list;
	}

	@Override
	public PageBean findByStatus(int pageNo) {
		String hql="from CstLost";
	    return this.lostdao.findByPage(hql,pageNo, 10);
	}

	@Override
	public void add(CstLost lost) {
		this.lostdao.save(lost);
		
	}

	@Override
	public void delete(Long lstId) {
		CstLost lost = this.lostdao.findById(lstId);
		this.lostdao.delete(lost);
	}

}
